package thread;

public class SyncDemo4 {
    class Boo{
        public synchronized void methodA(){
            try {
                Thread t=Thread.currentThread();
                System.out.println(t.getName()+"正在执行A方法...");
                Thread.sleep(5000);
                System.out.println(t.getName()+"A方法执行完毕！");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        public synchronized void methodB(){
            try {
                Thread t=Thread.currentThread();
                System.out.println(t.getName()+"正在执行B方法...");
                Thread.sleep(5000);
                System.out.println(t.getName()+"B方法执行完毕！");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        Boo boo=new Boo();
        Thread t1=new Thread(){
            public void run() {
                
            }
        };
    }
}
